Skip to content

Conversation

@ehigham
Copy link
Member

@ehigham ehigham commented Nov 5, 2025

I believe the spark version bump switched the runtime logging implementation to log4j core v2. This broke our py4j logging configuration tacitly. After switching over to v2 I discovered that we don't need things like the StringSocketAppender​ because we're redirecting the jvm's stderr to python.

We use the hail jar in a few situations with slightly different requirements - tests, py4j, py4j in batch and qob:

  • For qob we want log4j to append to stdout as that'll appear in the job logs.
  • For tests, we want low verbosity lest we're driven to madness searching for failure logs in the test output
  • For py4j in batch, we want the job log to contain what we usually log to the hail log file as that's lost after a job terminated.
  • For py4j in an ipython session, we probably only want warnings or errors or our users will hate us.

This is what Py4jUtils.configureLogging​ attempts to address: when binging to apy4j​ gateway, we need to reconfigure the logging configuration so we can forward logs to stderr and write to our logfile.

Note that the configuration contains a spark logger - the logs are quite noisy and adding this allows us to control how much noise we want from spark.

This change cannot impact the Hail Batch instance as deployed by Broad Institute in GCP

@ehigham ehigham marked this pull request as ready for review November 5, 2025 05:53
Copy link
Member Author

ehigham commented Nov 5, 2025

@ehigham ehigham changed the title [query] Use Log4j 2 Api [query] use log4j2 Nov 5, 2025
@ehigham ehigham changed the base branch from ehigham/experimental-init to graphite-base/15176 November 5, 2025 15:46
@ehigham ehigham force-pushed the graphite-base/15176 branch from 71be1cd to e215e19 Compare November 5, 2025 15:46
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from 1849ac0 to 7d9a51a Compare November 5, 2025 15:46
@ehigham ehigham changed the base branch from graphite-base/15176 to ehigham/query-cloud-credentials November 5, 2025 15:46
@ehigham ehigham force-pushed the ehigham/query-cloud-credentials branch from e215e19 to 349270e Compare November 6, 2025 17:37
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from 7d9a51a to fb70546 Compare November 6, 2025 17:37
@ehigham ehigham changed the base branch from ehigham/query-cloud-credentials to graphite-base/15176 November 6, 2025 19:00
@ehigham ehigham force-pushed the graphite-base/15176 branch from 349270e to 49de5d0 Compare November 6, 2025 19:01
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from fb70546 to 48f939c Compare November 6, 2025 19:01
@ehigham ehigham changed the base branch from graphite-base/15176 to ehigham/experimental-init November 6, 2025 19:01
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch 3 times, most recently from 928f7e9 to f5248ee Compare November 6, 2025 20:48
@ehigham ehigham changed the base branch from ehigham/experimental-init to graphite-base/15176 November 6, 2025 21:21
@ehigham ehigham force-pushed the graphite-base/15176 branch from 49de5d0 to a37d752 Compare November 6, 2025 21:21
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from f5248ee to 54fcb8a Compare November 6, 2025 21:21
@ehigham ehigham changed the base branch from graphite-base/15176 to ehigham/query-cloud-credentials November 6, 2025 21:22
@ehigham ehigham force-pushed the ehigham/query-cloud-credentials branch from a37d752 to 7793d61 Compare November 7, 2025 15:29
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch 3 times, most recently from c94c16c to d6bda61 Compare November 7, 2025 17:53
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from d6bda61 to 4e4348c Compare November 7, 2025 20:07
Base automatically changed from ehigham/query-cloud-credentials to main November 13, 2025 16:11
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from 4e4348c to 72e7d4b Compare November 13, 2025 16:20
@ehigham ehigham force-pushed the ehigham/log4j-socker-appender branch from 72e7d4b to e4b2ab2 Compare November 13, 2025 16:52
Copy link
Collaborator

@chrisvittal chrisvittal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much more sane. Thank you for this.

@hail-ci-robot hail-ci-robot merged commit 836f24b into main Nov 13, 2025
3 checks passed
@hail-ci-robot hail-ci-robot deleted the ehigham/log4j-socker-appender branch November 13, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants